﻿/*
 * Copyright (c) Jason Paul Morley, 2010
 * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core
{
    public class Node
    {
        private static string _spv_nextId = "a";
        private static int _spv_incPos = 0;
        protected static string MakeId()
        {
            string r = _spv_nextId;
            if (_spv_nextId[_spv_incPos] == 'z')
            {
                _spv_nextId += 'a';
                ++_spv_incPos;
            }
            else
            {
                char[] cA = _spv_nextId.ToCharArray();
                cA[_spv_incPos] = (char)((byte)cA[_spv_incPos] + 1);
                _spv_nextId = new string(cA);
            }
            return r;
        }

        public Node(Point p)
        {
            distance = double.PositiveInfinity;
            id = MakeId();
            position = p;
            state = State.Visible;
        }

        public double distance;
        public string id;
        public Point position;
        public State state;
    }
}
